<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>首页</h1>
<form th:action="@{/testRequestBody}" method="post">
    username: <input type="text" name="username"><br>
    password: <input type="password" name="password"><br>
    <input type="submit" value="testRequestBody">
</form>
<hr>
<form th:action="@{/testRequestEntity}" method="post">
    username: <input type="text" name="username"><br>
    password: <input type="password" name="password"><br>
    <input type="submit" value="testRequestEntity">
</form>
<a th:href="@{/testResponse}">testResponse</a><br>
<a th:href="@{/testResponseBody}">testResponseBody</a><br>
<a th:href="@{/testResponseUser}">testResponseUser</a><br>
<div id="app">
    <a @click="testAxios" th:href="@{/testAxios}">testAxios</a>
</div>
<a th:href="@{/file}">file</a><br>
<script type="text/javascript" src="/static/js/vue.js"></script>
<script type="text/javascript" src="/static/js/axios.min.js"></script>
<script type="text/javascript">
    new Vue({
        el: '#app',
        data(){
            return {}
        },
        props: [],
        computed:{},
        components:{},
        methods:{
            testAxios(e){
                axios({
                    method: 'POST',
                    url: e.target.href,
                    data: {
                        username: "admin",
                        password: "123",
                    }
                }).then(resp => {
                    alert(resp.data);
                });
                // 取消默认
                e.preventDefault();
                // 阻止冒泡
                e.stopPropagation();
            },
        },
        watch:{},
        filters: {},
        directives: {},
    });
</script>
</body>
</html>